// ignore_for_file: non_constant_identifier_names

import 'dart:io';

import 'package:sj001/user/UserData.dart';

class Utils {
  static String appName = '浮生AI';

  // static String app_user = 'abc-123';

  // static String base_url = 'http://120.25.245.214:980/v1';
  static String base_url = 'http://tx.beenest.club:980/v1';

  static String uploadFile = 'files/upload';
  static String historyConversations = 'conversations';
  static String chat_messages = 'chat-messages';
  static String messages = 'messages';
  static String suggested = 'suggested';
  static String feedbacks = 'feedbacks';

  // static String app_key = 'app-2X10o8ruc68N0pvwBzm7sh9D';
  static String app_key = 'app-8iSXjkjMyYIaRqZ32lpYRXUG';

  static String get app_user {
    return UserManager.instance.userData?.userName ?? '';
  }


  static bool isMobile() {
    return Platform.isIOS || Platform.isAndroid;
  }

  static String strFromMilseconds(int milSecond,{int type = 1}){
    return strFromDateTime(DateTime.fromMillisecondsSinceEpoch(milSecond*1000),type: type);
  }

  static String strFromDateTime(DateTime date, {int type = 1}) {
    if (type == 1) {
      return '${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')} ${date.hour.toString().padLeft(2, '0')}:${date.minute.toString().padLeft(2, '0')}:${date.second.toString().padLeft(2, '0')}';
    }

    return '';
  }
}
